class AcGameMenu{

    constructor(root){
       
        this.root = root;

        this.$menu = $(`
<div class="ac-game-menu">
    <div class="ac-game-menu-field">
        <div class="ac-game-menu-field-item ac-game-menu-field-item-single-mode">
               单人模式
        </div>
        <br/>
        <div class="ac-game-menu-field-item ac-game-menu-field-item-multi-mode">
            多人模式
        </div>
        <br/>
        <div class="ac-game-menu-field-item ac-game-menu-field-item-settings">
            退出
        </div>
        <br/>
    </div>
</div>
            `);
        this.root.$ac_game.append(this.$menu)
        this.$single_mode = this.$menu.find("."+"ac-game-menu-field-item-single-mode");
        this.$multi_mode = this.$menu.find("."+"ac-game-menu-field-item-multi-mode");
        this.$settings = this.$menu.find("."+"ac-game-menu-field-item-settings");
        

        this.start();

    }


    start(){

        this.add_listening_event();

    }

    add_listening_event(){
        let outer = this;
        console.log(this.$single_mode);
        this.$single_mode.click(function (){
            console.log(outer.root);
            outer.root.playground.show();
            outer.hide();
        })

        this.$multi_mode.click(function (){
            console.log("Hell");
        })

        this.add_listening_settings(); 

    }

    add_listening_settings(){
    let outer = this;

     this.$settings.click(function (){
         console.log(outer.root);
            outer.root.settings.logout_to_remote();            
        })

    }


    show(){
        this.$menu.show();

    }

    hide(){
        this.$menu.hide();
    }

}
